angular.module('myApp')
    .directive('listPaging',function($rootScope,$timeout) {
        return {
            restrict: 'ACE',
            template:'<div class="row"><style>.pagination{margin-top: 0;margin-bottom: 0}</style><div class="col-sm-4 hidden-xs"><select class="input-sm form-control w-sm inline v-middle" ng-model="pagingData.rownum" ng-options="o as o for o in selected" ng-change="pagingSelChange({num:pagingData.rownum})"></select></div><div class="col-sm-8 text-right text-center-xs"><div class="pagination pagination-sm m-t-none m-b-none"><uib-pagination boundary-links="true" total-items="pagingData.rowtotal" max-size="pageSize" items-per-page="pagingData.rownum" ng-model="pagingData.currentpage" ng-change="pagingPageChange({num:pagingData.currentpage})" class="pagination-sm" previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination></div></div></div>',
            scope:{
                pagingData:'=',
                pagingSelChange:'&',
                pagingPageChange:'&'
            },
            link: function(scope, el, attrs){
                scope.pageSize = 5;
                scope.selected = ['5','10','20','50'];
            }
        };
    });